<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <!-- 引入 css -->
    <link href="/admin/plugin/wangEditor/style.css" rel="stylesheet">
    <!-- 引入 js -->
    <script src="/admin/plugin/wangEditor/index.js"></script>

    <!--引入 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <!-- 必须先引入vue，  后使用element-ui -->
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <!-- 引入element 的组件库-->
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

    <script type="text/javascript" src="/admin/plugin/element-ui/httpVueLoader.js"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1"></script>


    <!--    引入Layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/admin/pageoffice.js"></script>

    <link rel="stylesheet" href="/admin/js-css/css/pageLR.css">


</head>
<body>
    <div id="app">
        <el-row style="margin-bottom: 10px;" >
            <el-button type="primary"  size="small" @click="add" >添加</el-button>
            <el-button type="success" size="small" @click="update" v-if="searchParmsData.type=='2'" >编辑</el-button>
            <el-button type="danger"  size="small" @click="deleteD" v-if="searchParmsData.type=='2'" >删除</el-button>
        </el-row>
        <el-collapse v-model="activeNames" >
            <el-collapse-item title="基本信息" name="1">
                <div>
                    <el-form :inline="true"  class="demo-form-inline" size="small">
                        <el-form-item label="年份">
                            <el-input  placeholder="年份" v-model="mapdata.year" ></el-input>
                        </el-form-item>
                        <el-form-item label="月份">
                            <el-input  placeholder="月份" v-model="mapdata.method" ></el-input>
                        </el-form-item>

                    </el-form>
                </div>
            </el-collapse-item>
            <el-collapse-item title="文档正文" name="2">
                <div>
                    <iframe :src="mapdata.pdf_path" frameborder="0" style="scrollbar-width: none;" width="100%" :height="iframeHeight"></iframe>
                </div>
            </el-collapse-item>

        </el-collapse>


    </div>
</body>

<script>
    var vm = new Vue({
        el:"#app",
        data:{
            activeNames:["1","2"],
            searchParmsData:{},
            mapdata:{},
            iframeHeight:0,
        },
        async created(){
            this.iframeHeight = top.document.body.clientHeight - 220;
            this.searchParmsData = getParams();
            this.getPdf();
        },
        methods:{
            add(){
                POBrowser.openWindowModeless('/admin/api/DocumentController/creatWord?tableId='+this.searchParmsData.tableId+"&code="+this.searchParmsData.id, 'fullscreen=yes;')
            },
            update(){
                POBrowser.openWindowModeless('/admin/api/DocumentController/updateWord?id='+this.searchParmsData.id, 'fullscreen=yes;')
            },
            deleteD(){
                top.alert("开发中...");
            },
            async getPdf(){
                const res = await postWebCustom(getTableId("847"),{id:this.searchParmsData.id});
                this.mapdata = res.data;
            },
            handleClick(tab, event) {

            }
        }
    });


    function setData(data) {
        if(Object.keys(data).length > 0){
            vm.baseObj = data;
        }

    }
</script>
</html>